import BattleObj from "../../../logic/battle/BattleObj";
import SkillEventTriggerType from "../SkillEventTriggerType";
import SkillTrigger from "../SkillTrigger";

/**
 * 事件触发器
 * 参数说明：
 * [触发类型为1，触发概率，事件id，事件对应的其他参数]
 */
export default class SkillEventTrigger extends SkillTrigger{
    eventId: number;//事件id
    random: number;//触发概率

    constructor(owner: BattleObj, type: number, skillId:number, params:number[]) {
        super(owner, type, skillId, params);
        this.eventId = params[2];
        this.random = params[3];
    }

    init() {
        //TODO 根据不同的事件id，注册不同的事件(向触发器拥有者注册，向房间注册)
        if(this.eventId == SkillEventTriggerType.AttackBefore){
            this.owner.eventDispatcher.on(SkillEventTriggerType.AttackBefore, this.attackBefore, this);
            return
        }
    }
    isTrigger(): boolean {
        return true;
    }

    attackBefore() {
        
    }
}